package com.diaohaiwen.basic.websockt.obj.vo;

import com.alibaba.fastjson.JSONObject;
import com.diaohaiwen.common.enums.WebsocketEnums;
import lombok.Getter;

/**
 * @author 刁海文
 * @since 2023/12/7 21:20
 */
@Getter
public class WebsocketVo<T> {

    private WebsocketEnums code;

    private T data;

    public static <T> WebsocketVo<T> build(WebsocketEnums code, T data) {
        WebsocketVo<T> web = new WebsocketVo<>();
        web.code = code;
        web.data = data;

        return web;
    }

    @Override
    public String toString() {
        return JSONObject.toJSONString(this);
    }
}
